package com.ten.shou.controller;


import com.ten.common.core.entity.TbBottomArticle;
import com.ten.common.core.vo.Result;
import com.ten.shou.service.BottomService;
import com.ten.shou.vo.BottomVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author ：杨（1964958771@qq.com）
 * @date ：Created in 2022/12/9 15:20
 * @description：
 * @modified By：
 * @version:
 */
@RestController
@RequestMapping("/home/bottomarticle")
@Api(tags = "底部文章接口类")
public class BottomController {
    @Resource
    private BottomService bottomService;
    @ApiOperation(value = "根据条件分页查询专区信息")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "current", value = "当前页码"),
                    @ApiImplicitParam(name = "pageSize", value = "每页显示的条数")
            }
    )
    @PostMapping("getAllBottomArticle/{current}/{pageSize}")
    public Result getAllBottomArticle(@PathVariable Integer current, @PathVariable Integer pageSize, @RequestBody BottomVo bottomVo){
        return bottomService.selectAllBottom(current,pageSize,bottomVo);
    }
    @PostMapping("addBottomArticle")
    public Result addBottomArticle(@RequestBody TbBottomArticle tbBottomArticle){
        return bottomService.insertAllBottom(tbBottomArticle);
    }
    @PostMapping("deleteBottomArticle")
    public Result deleteBottomArticle(@RequestBody TbBottomArticle tbBottomArticle){
        return bottomService.deleteByIdBottom(tbBottomArticle);
    }
    @PostMapping("changeStatus/{id}/{isDisable}")
    public Result changeStatus(@PathVariable String id,@PathVariable int isDisable){
        return bottomService.updateStatusBottom(id,isDisable);
    }
    @PostMapping("editBottomArticle")
    public Result editBottomArticle(@RequestBody TbBottomArticle tbBottomArticle){
       return bottomService.updateBottomTitle(tbBottomArticle);
    }
}
